﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using IniTechCaash.Domain.Entities;
using System.Web;

namespace IniTechCaash.Domain.EntityFramework
{
    public class CaashContext : DbContext
    {
        public CaashContext()
            : base("Server=tcp:bj8fcntt2t.database.windows.net,1433;Database=initech-tetelestai;User ID=initechdba@bj8fcntt2t;Password=Initech#2014;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True")
        {

        }
        //public CaashContext()
        //    : base(@"Data Source=.\SQLExpress;Database=DomainDatabase;Integrated Security=True;MultipleActiveResultSets=True")
        //{

        //}
        ////"Data Source=.\SQLExpress;Database=OMS;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //modelBuilder.Entity<JournalEntry>().HasOptional(j => j.SourceDocument).WithRequired(s => s.JournalEntry);
            //modelBuilder.Entity<SourceDocument>().HasRequired(s => s.JournalEntry).WithOptional(j => j.SourceDocument);
        }


        public IDbSet<Account> Accounts { get; set; }

        public IDbSet<ActivityLog> ActivityLogs { get; set; }

        public IDbSet<JournalEntry> JournalEntries { get; set; }

        public IDbSet<JournalEntryLine> JournalEntryLines { get; set; }

        //public IDbSet<SourceDocument> SourceDocuments { get; set; }

        public IDbSet<User> Users { get; set; }
    }
}
